#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 1000 + 20;
const int MOD = 1e9 + 7;
string s, t;
long long dp1[N], dp2[N], f[N], f1[N], ps[N];
void kmp() {
  long long curr = 0;
  for (int i = 2; i <= t.size(); i++) {
    while (curr > 0 && t[i - 1] != t[curr]) curr = f1[curr];
    if (t[i - 1] == t[curr]) curr++;
    f1[i] = curr;
  }
  curr = 0;
  for (int i = 2; i <= s.size(); i++) {
    while (curr > 0 && s[i - 1] != t[curr]) curr = f1[curr];
    if (s[i - 1] == t[curr]) curr++;
    f[i] = curr;
  }
  bool tmp = true;
  for (int i = 1; i <= t.size(); i++)
    if (s[i - 1] != t[i - 1]) {
      tmp = false;
      break;
    }
  if (tmp) f[t.size()] = t.size();
}
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> s >> t;
  if (t.size() > s.size()) return cout << 0 << '\n', 0;
  kmp();
  for (int i = t.size(); i <= s.size(); i++) {
    if (f[i] == t.size()) {
      dp1[i] = dp1[i - 1] + ps[i - t.size()] + i - t.size() + 1;
      dp1[i] %= MOD;
      dp2[i] = ps[i - t.size()] + i - t.size() + 1;
      dp2[i] %= MOD;
    } else {
      dp1[i] = dp1[i - 1] + dp2[i - 1];
      dp1[i] %= MOD;
      dp2[i] = dp2[i - 1];
    }
    ps[i] = ps[i - 1] + dp1[i];
    ps[i] %= MOD;
  }
  cout << dp1[s.size()] << '\n';
  return 0;
}
