#include <bits/stdc++.h>
using namespace std;
void abc() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int mod = 998244353;
vector<int> steps;
vector<int> dp;
int go(int s) {
  if (s < 1) return 0;
  if (s == 1) return 1;
  if (dp[s] != -1) return dp[s];
  int res = 0;
  for (int i = 0; i < steps.size(); i++) {
    res = (res + go(s - steps[i])) % mod;
  }
  return dp[s] = res;
}
int main() {
  abc();
  int top, k;
  cin >> top >> k;
  set<int> s;
  for (int i = 0; i < 2 * k; i++) {
    int x;
    cin >> x;
    s.insert(x);
  }
  for (auto i : s) steps.push_back(i);
  dp.resize(top + 1, -1);
  cout << go(top) << endl;
}
