#include <bits/stdc++.h>
using namespace std;
int n;
void print(vector<int> v) {
  cout << "-------" << endl;
  for (int i : v) {
    cout << i << " ";
  }
  cout << endl << "---------" << endl;
  ;
}
void func(int x, unordered_map<int, int>& set, int& count, vector<int>& v) {
  if (x > n) return;
  if (x == n) {
    count++;
    return;
  }
  for (auto itr = set.begin(); itr != set.end(); itr++) {
    x += itr->first;
    v.push_back(x);
    func(x, set, count, v);
    v.pop_back();
    x -= itr->first;
  }
}
int main() {
  int k;
  cin >> n >> k;
  unordered_map<int, int> s;
  for (int i = 0; i < k; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    s[t1] = 1;
    s[t2] = 1;
  }
  vector<int> v;
  int count = 0;
  func(1, s, count, v);
  cout << count << endl;
}
