
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ctime>
#include<deque>
using namespace std;

#define fr                first
#define se                second
#define int               long long
#define pb                push_back
#define mp                make_pair
#define pii               pair<int,int>
#define vi                vector<int>
#define vvi                vector<vector<int>>
#define mi                map<int,int>
#define pq                priority_queue<int>
#define set_bits(x)       __builtin_popcountll(x)
#define mod               1000000007
#define inf               1e18                        //Defining infinity the overflow of int
#define ps(x,y)           fixed<<setprecision(y)<<x   //for defining the precision of the decimal upto y places.
#define zrosetbits(x)     __builtin_ctzll(x)         //it will give no of 0's before the first 1 from the right.
#define mk(a,n,type)      type *a=new type[n];
#define test(t)           int t; cin>>t; while(t--)
#define no                cout<<"No\n";
#define yes               cout<<"Yes\n";
#define NO                cout<<"NO\n";
#define YES               cout<<"YES\n";
//#define for(i,n)          for(int i=0;i<n;i++)
//#define for(j,n)          for(int j=0;j<n;j++)
// #define forn(i,n)               for(int i=0;i<n;i--)



//**********************************************************************************************************
struct custom_hash
{
  static uint64_t splitmix64(uint64_t x)
  {
    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }

  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

#define safemap               unordered_map<int,int,custom_hash>

//*********************************************************************************************************

void io()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin.tie(0);
}


int helper(int cell, vector<int> &v, vi &dp, int n)
{
  //Base Case
  if (cell == n)
    return 1;

  if (dp[cell] != -1)
    return dp[cell];

  //recursive Case
  int res = 0;

  for (int i = 0; i < v.size(); i++)
  {
    if (cell + v[i] <= n)
      res = (res % 998244353 + helper( cell + v[i], v, dp, n) % 998244353) % 998244353;

    else
      break;
  }

  dp[cell] = res;

  return res;
}



int32_t main()
{
  int n, k;
  cin >> n >> k;

  map<int, int> mp;

  for (int i = 0; i < k; i++)
  {
    cin >> p >> q;

    mp[p]++;
    mp[q]++;
  }

  vi v;

  for (auto x : mp)
    v.pb(x.first);

  sort(v.begin(), v.end());

  vi dp(n + 1, -1);

  cout <<  helper(1, v, dp, n) % 998244353 << "\n";

  return 0;
}
