#include <bits/stdc++.h>
using namespace std;
const int mm = 3333;
const int mn = 222;
const int mod = 1000000007;
long long f[mm][mn];
long long g[mm][mn], ans;
int a[mn];
int i, j, k, n, l;
int main() {
  while (~scanf("%d%d", &n, &l)) {
    for (i = 1; i <= n; ++i) scanf("%d%d", &a[i], &a[n + i]);
    memset(f, 0, sizeof(f));
    memset(g, 0, sizeof(g));
    for (j = 1; j <= 2 * n; ++j) g[0][a[j]] = 1;
    for (i = 1; i <= l; ++i)
      for (j = 1; j <= 2 * n; ++j)
        if (a[j] <= i)
          if (j <= n) {
            f[i][j] += g[i - a[j]][a[j]];
            if (a[j + n] == a[j]) f[i][j] -= f[i - a[j]][j];
            f[i][j] -= f[i - a[j]][j + n];
            if (f[i][j] < 0) f[i][j] += mod;
            f[i][j] %= mod;
            g[i][a[j + n]] += f[i][j];
            g[i][a[j + n]] %= mod;
          } else if (a[j - n] != a[j]) {
            f[i][j] += g[i - a[j]][a[j]];
            if (a[j - n] == a[j]) f[i][j] -= f[i - a[j]][j];
            f[i][j] -= f[i - a[j]][j - n];
            if (f[i][j] < 0) f[i][j] += mod;
            f[i][j] %= mod;
            g[i][a[j - n]] += f[i][j];
            g[i][a[j - n]] %= mod;
          }
    ans = 0;
    for (i = 1; i <= 2 * n; ++i) {
      ans += f[l][i];
      ans %= mod;
    }
    cout << ans << endl;
  }
  return 0;
}
