fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int m, n;
  6. cin >> m >> n;
  7. int arr[m];
  8. for(int i = 0; i < m; i++){
  9. cin >> arr[i];
  10. }
  11. int cnt = 0;
  12. for(int i = 0; i < m; i++){
  13. if(arr[i]==n){
  14. cnt++;
  15. }
  16. }
  17. if(cnt > 0){
  18. cout << "YES" << endl;
  19. }
  20. else {
  21. cout << "NO" << endl;
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5324KB
stdin
5 10
7 3 5 2 1
stdout
NO