#include <bits/stdc++.h>
using namespace std;
class solve {
  int n, m;
  string D, s;
  vector<int> kmp;
  vector<long long> dp[3];
  vector<int> match;
  set<int> positions;
  void kmp_make() {
    kmp.resize(n);
    int curr = 0, i = 1, z = 0;
    while (i < n) {
      while (curr && D[i] != D[curr]) curr = kmp[curr - 1];
      while (i + z < n && D[i + z] == D[curr]) {
        kmp[i + z] = curr + 1;
        ++curr;
        ++z;
      }
      i = i + max(1, z);
      z = 0;
    }
  }
  void kmp_matcher() {
    match.resize(m);
    int j = 0, curr = 0;
    while (j < m) {
      while (curr && s[j] != D[curr]) {
        curr = kmp[curr - 1];
      }
      if (s[j] == D[curr]) {
        int z = 0;
        while (j < m && curr < n && s[j] == D[curr]) {
          ++j;
          ++curr;
        }
        if (curr == n) {
          match[j - 1] = 1;
          curr = kmp[curr - 1];
        }
      } else {
        ++j;
      }
    }
  }
  void ans() {
    dp[0].resize(m, 0);
    dp[1].resize(m, 0);
    dp[2].resize(m, 0);
    for (int i = 0; i < m; i++) {
      if (match[i]) {
        dp[2][i] = (i - n + 2) + (i - n < 0 ? 0 : dp[1][i - n]);
      } else
        dp[2][i] =
            ((i - 1 < 0 ? 0 : dp[2][i - 1])) % static_cast<long long>(1e9 + 7);
      dp[0][i] = ((i - 1 < 0 ? 0 : dp[0][i - 1]) + dp[2][i]) %
                 static_cast<long long>(1e9 + 7);
      dp[1][i] = ((i - 1 < 0 ? 0 : dp[1][i - 1]) + dp[0][i]) %
                 static_cast<long long>(1e9 + 7);
    }
    cout << dp[0][m - 1] << endl;
    return;
  }

 public:
  solve() {
    cin >> s >> D;
    n = D.length();
    m = s.length();
    kmp_make();
    kmp_matcher();
    ans();
  }
};
int main() {
  int t = 1;
  while (t--) new solve;
  return 0;
};
