#include <bits/stdc++.h>
using namespace std;
string st, zr;
long long pw1[1 << 20], pw2[1 << 20], s1, s2;
pair<long long, long long> need;
long long n;
long long lent;
long long ts1[1 << 20], ts2[1 << 20], temp, dp[1 << 20], val1, val2;
long long sdp[1 << 20];
long long ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> st;
  cin >> zr;
  pw1[0] = 1;
  pw2[0] = 1;
  for (int i = 1; i <= 300000; i++) {
    pw1[i] = pw1[i - 1] * 173 % 1000000007ll;
    pw2[i] = pw2[i - 1] * 187 % 1000000009ll;
  }
  for (int i = 0; i < zr.size(); i++) {
    s1 = s1 + zr[i] * pw1[i];
    s1 %= 1000000007ll;
    s2 = s2 + zr[i] * pw2[i];
    s2 %= 1000000009ll;
  }
  s1 *= pw1[200000];
  s2 *= pw2[200000];
  s1 %= 1000000007ll;
  s2 %= 1000000009ll;
  need = make_pair(s1, s2);
  n = st.size();
  lent = -1;
  dp[0] = 1;
  sdp[0] = 1;
  for (int i = 1; i <= st.size(); i++) {
    ts1[i] = ts1[i - 1] + st[i - 1] * pw1[i - 1];
    ts2[i] = ts2[i - 1] + st[i - 1] * pw2[i - 1];
    ts1[i] %= 1000000007ll;
    ts2[i] %= 1000000009ll;
    temp = dp[i - 1];
    dp[i] = temp;
    if (i >= zr.size()) {
      val1 = ts1[i] - ts1[i - zr.size()];
      val2 = ts2[i] - ts2[i - zr.size()];
      val1 *= pw1[200000 - i + zr.size()];
      val2 *= pw2[200000 - i + zr.size()];
      val1 %= 1000000007ll;
      val2 %= 1000000009ll;
      if (val1 < 0) val1 += 1000000007ll;
      if (val2 < 0) val2 += 1000000009ll;
      if (val1 == need.first && val2 == need.second) lent = i - zr.size();
    }
    if (lent != -1) {
      dp[i] += sdp[lent];
      dp[i] %= 1000000007ll;
      ans = ans + sdp[lent];
      ans %= 1000000007ll;
    }
    sdp[i] = sdp[i - 1] + dp[i];
    sdp[i] %= 1000000007ll;
  }
  cout << ans << endl;
  cin.get();
  cin.get();
  return 0;
}
