#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  string S;
  cin >> S;
  S = "$" + S;
  string T;
  cin >> T;
  int n = S.size();
  int t = T.size();
  vector<int> dp(n, 0);
  int sum = 0;
  int ret = 0;
  for (int i = t; i < n; ++i) {
    sum = (sum + dp[i - t] + 1) % mod;
    if (S.compare(i - t + 1, t, T) == 0) {
      ret = sum;
    }
    dp[i] = (dp[i - 1] + ret) % mod;
  }
  cout << dp[n - 1];
  return 0;
}
