#include #include #include using namespace std; int main(void) { int n, s; cin >> s >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); int count = 0; for (int i = 0; i < n; i++) { if (binary_search(a.begin() + i + 1, a.end(), s - a[i])) { count++; } } cout << count << endl; return 0; }