Uh, what is the context of this question? Do you literally just want to get it done? Does it matter what language? Do you care about efficiency? Do you just care about the algorithm in an abstract form?
The best way to compare them is to first sort each list, which takes O(nlgn) time, then compare the two lists using something like;
while(a.isMore()&&b.isMore()) {
if(a.peek()==b.peek() print(a.peek());
if(a.peek()>b.peek()) b.pop();
else a.pop();
}
In total this would be O(nlgn+mlgm+n+m)=O(nlgn) which is very efficient. For the record, it can be done in O(n) since the domain is bounded.