#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, N = 20, M = 1 << 5;
int n, m;
int f[2][N][N][N][N][2][2], (*nxt)[N][N][N][2][2] = f[1],
                            (*cur)[N][N][N][2][2] = *f;
int snx[M], sny[M], spx[M], spy[M], A;
void add(int &x, int y) {
  x += y - mod;
  x += x >> 31 & mod;
}
int main() {
  scanf("%d%d", &n, &m);
  A = (1 << n) - 1;
  int x, y;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    if (x < 0)
      snx[1 << i] -= x;
    else
      spx[1 << i] += x;
    if (y < 0)
      sny[1 << i] -= y;
    else
      spy[1 << i] += y;
  }
  for (int i = 1; i <= A; i++)
    spx[i] = spx[i - (i & -i)] + spx[i & -i],
    spy[i] = spy[i - (i & -i)] + spy[i & -i],
    snx[i] = snx[i - (i & -i)] + snx[i & -i],
    sny[i] = sny[i - (i & -i)] + sny[i & -i];
  ******nxt = 1;
  for (; m; m >>= 1) {
    int c = m & 1, tmp;
    swap(nxt, cur);
    memset(nxt, 0, sizeof *f);
    for (int ppx = 0; ppx <= spx[A]; ppx++)
      for (int ppy = 0; ppy <= spy[A]; ppy++)
        for (int pnx = 0; pnx <= snx[A]; pnx++)
          for (int pny = 0; pny <= sny[A]; pny++)
            for (int ox = 0; ox < 2; ox++)
              for (int oy = 0; oy < 2; oy++)
                if (tmp = cur[ppx][pnx][ppy][pny][ox][oy])
                  for (int d = 0; d <= A; d++) {
                    int npx = ppx + spx[d], npy = ppy + spy[d],
                        nnx = pnx + snx[d], nny = pny + sny[d];
                    if (((npx ^ nnx) | (npy ^ nny)) & 1) continue;
                    add(nxt[npx >> 1][nnx >> 1][npy >> 1][nny >> 1]
                           [(npx ^ c) & 1 ? !c : ox][(npy ^ c) & 1 ? !c : oy],
                        tmp);
                  }
  }
  printf("%d\n", ((******nxt) + mod - 1) % mod);
  return 0;
}
