#include <bits/stdc++.h>
using namespace std;
int n;
int a[100], b[100];
int res[100][3001][101] = {0};
bool us[100][3001][101] = {0};
const int mod = 1000000007;
int work(int ll, int pr = -1, int lpred = -1) {
  if (ll < 0) return 0;
  if (ll == 0) return 1;
  if (pr != -1 && us[pr][ll][lpred] != 0) return res[pr][ll][lpred];
  int r = 0;
  for (int i = 0; i < n; i++)
    if (i != pr) {
      if ((lpred == -1) || (a[i] == lpred))
        r = (r + work(ll - a[i], i, b[i])) % mod;
      if ((a[i] != b[i]) && ((lpred == -1) || (b[i] == lpred)))
        r = (r + work(ll - b[i], i, a[i])) % mod;
    }
  if (pr != -1) {
    res[pr][ll][lpred] = r;
    us[pr][ll][lpred] = 1;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  int l;
  cin >> n >> l;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  cout << work(l);
}
