Assignment Tools

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 3318
64-bit integer IO format: %I64d      Java class name: Main

Description

In Valentine’s Day, lovers usually send gifts to their GF or BF. To express their sincerity, they choose DIY.

Small JH want to make a surprise to his GF, so he finds a shop named “DIY Space”. But there are so many people scramble for tools to make their gifts. To solve the problem, the boss makes a rule:

1.You will not regain the tool until you can complete all things what you need to do.(If someone has all tools he needs, he will complete immediately. Otherwise, he can’t do anything)

2.If the boss has enough tools he will give you when you need tools.

3.You don't have to queue up.

Small JH should wait until all people leave, because he needs all tools.

People have their tools and never return before completing their tasks. Sometimes it has a state: the boss has no tools any more and everyone can’t get enough tools.

Please tell him whether he should wait.

Input

The input consist of several cases, please deal with till the end of file. Each case contains two integers N and M (0 < N, M <= 100), representing there are N kinds of tools and M people. Second line there are N integers, N(i) means the boss own Ni number of ith tool(equal to the number of tools Small JH need).Then follow M lines, each consisting N integers, the number in ith row and jth column means the amount of the jth tools that the ith people need. After it there also M lines, each line has N integers too, the number in ith row and jth column means this amount of jth tools have been allotted to the ith people.

The total number of ith tool that all people own will not bigger than boss own at first.

Output

Please print “Yes” if Small JH can wait the end, or print “No” if he can’t;

Sample Input

2 2
10 11
9 8
5 8
2 3
3 5

2 2
10 10
9 8
5 8
2 3
3 5

Sample Output

Yes
No

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .