#include <bits/stdc++.h>
using namespace std;
long long z[3101][101][101];
long long a[201];
long long b[201];
vector<pair<int, int>> per[201];
int main() {
  int n, l;
  cin >> n >> l;
  long long ma = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    per[a[i]].push_back(make_pair(b[i], i));
    z[b[i]][a[i]][i] += 1LL;
    if (a[i] != b[i]) {
      per[b[i]].push_back(make_pair(a[i], i));
      z[a[i]][b[i]][i] += 1LL;
    }
    ma = max(ma, a[i]);
    ma = max(ma, b[i]);
  }
  for (int i = 1; i <= l; i++)
    for (int j = 1; j <= ma; j++)
      for (int num = 1; num <= n; num++)
        if (z[i][j][num])
          for (int q = 0; q < per[j].size(); q++)
            if (per[j][q].second != num) {
              z[i + j][per[j][q].first][per[j][q].second] += z[i][j][num];
              z[i + j][per[j][q].first][per[j][q].second] %= 1000000007;
            }
  long long ans = 0LL;
  for (int i = 1; i <= ma; i++)
    for (int j = 1; j <= n; j++) {
      ans += z[l][i][j];
      ans %= 1000000007;
    }
  cout << ans << endl;
  return 0;
}
