#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  string t, s;
  cin >> s >> t;
  n = t.size();
  vector<long long> pi(n + 1, 0);
  for (long long i = (long long)1; i != (long long)n; i = i + 1) {
    long long j = pi[i - 1];
    while (j >= 0 && t[i] != t[j]) {
      j = j > 0 ? pi[j - 1] : -1;
    }
    pi[i] = j + 1;
  }
  vector<long long> dp1(s.size() + 1, 0), dp2(s.size() + 1, 0),
      dp3(s.size() + 1, 0);
  vector<long long> pos;
  long long curpi = 0;
  for (long long i = (long long)0; i != (long long)s.size(); i = i + 1) {
    long long j = curpi < n ? curpi : pi[curpi - 1];
    while (j >= 0 && s[i] != t[j]) {
      j = j > 0 ? pi[j - 1] : -1;
    }
    curpi = j + 1;
    if (curpi == n) {
      pos.push_back(i);
    }
  }
  if (pos.size() == 0) {
    cout << 0 << '\n';
    return 0;
  }
  long long j = 0;
  for (long long i = (long long)0; i != (long long)s.size(); i = i + 1) {
    if (j < pos.size() && i == pos[j]) {
      j++;
      dp1[i + 1] = (dp3[i + 1 - n] + i + 2 - n) % mod;
      dp2[i + 1] = (dp1[i + 1] + dp2[i]) % mod;
    } else {
      dp1[i + 1] = dp1[i];
      dp2[i + 1] = (dp2[i] + dp1[i + 1]) % mod;
    }
    dp3[i + 1] = (dp3[i] + dp2[i + 1]) % mod;
  }
  cout << dp2[s.size()] << '\n';
}
