#include <bits/stdc++.h>
using namespace std;
long long counter(vector<long long> &arr, long long a, long long n) {
  if (a == n) return 1;
  if (a > n) return 0;
  long long count = 0;
  for (long long i = 0; i < arr.size(); i++) {
    count += counter(arr, a + arr[i], n);
  }
  return count;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> arr;
  unordered_set<long long> s;
  for (long long i = 0; i < 2 * k; i++) {
    long long a;
    cin >> a;
    if (s.find(a) == s.end()) {
      s.insert(a);
      arr.push_back(a);
    }
  }
  cout << counter(arr, 1, n) << endl;
}
