#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n;
int a[(100 + 10)], b[(100 + 10)];
int dp[3000 + 1][100 + 1][100 + 2];
int f(int len, int w, int pre) {
  if (len < 0) return 0;
  if (len == 0) return 1;
  int& ans = dp[len][w][pre];
  if (~ans) return ans;
  ans = 0;
  for (int i(0), _n(n); i < _n; ++i)
    if (i != pre) {
      if (a[i] == w)
        ans = (ans + f(len - b[i], b[i], i)) % MOD;
      else if (b[i] == w)
        ans = (ans + f(len - a[i], a[i], i)) % MOD;
    }
  return ans;
}
int main() {
  memset((dp), -1, sizeof(dp));
  int l;
  scanf("%d", &(n)), scanf("%d", &(l));
  for (int i(0), _n(n); i < _n; ++i) scanf("%d", &(a[i])), scanf("%d", &(b[i]));
  long long ans = 0;
  for (int w(1), _h(100); w <= _h; ++w) ans = (ans + f(l, w, 101)) % MOD;
  printf("%d\n", ans);
  return 0;
}
