#include <bits/stdc++.h>
using namespace std;
priority_queue<char, vector<char>, greater<char> > pq;
double startTime;
double getCurrentTime() {
  return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int power(long long int x, unsigned long long int y,
                    long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int a[205], b[205], dp[250][3005];
long long int mod = 1e9 + 7;
long long int n;
long long int solve(long long int l, long long int i) {
  if (dp[i][l] != -1) return dp[i][l];
  if (l == 0) return 0;
  long long int j, ans = 0;
  for (j = 1; j <= 2 * n; j++) {
    if (a[j] == -1 || (i != 0 && (j == i || j == i + n || j == i - n)))
      continue;
    if (i == 0 || a[j] == b[i]) {
      if (a[j] < l)
        ans = (ans + solve(l - a[j], j)) % mod;
      else if (a[j] == l)
        ans = (ans + 1) % mod;
    }
  }
  dp[i][l] = ans;
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int l;
  cin >> n >> l;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    a[i + n] = b[i];
    b[i + n] = a[i];
    if (a[i] == b[i]) a[i + n] = -1;
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(l, 0);
  return 0;
}
