#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
inline int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
inline int mul(int a, int b) { return a * 1ll * b % mod; }
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += mod;
  return a;
}
const int N = 2e5 + 100;
int dp[N], pre[N], prepre[N];
int pi[N];
void kmp(string s) {
  pi[0] = 0;
  for (int i = 1; i < s.size(); ++i) {
    int j = pi[i - 1];
    while (j && s[j] != s[i]) {
      j = pi[j - 1];
    }
    if (s[i] == s[j]) ++j;
    pi[i] = j;
  }
}
bool good[N];
int main() {
  string s, t;
  cin >> s >> t;
  string k = t + "#" + s;
  kmp(k);
  for (int i = 1; i <= s.size(); ++i) {
    if (pi[i + t.size()] == t.size()) good[i] = 1;
  }
  for (int i = 1; i <= s.size(); ++i) {
    if (!good[i]) {
      dp[i] = dp[i - 1];
      pre[i] = add(pre[i - 1], dp[i]);
      prepre[i] = add(prepre[i - 1], pre[i]);
    } else {
      dp[i] = add(prepre[i - t.size()], i - t.size() + 1);
      pre[i] = add(pre[i - 1], dp[i]);
      prepre[i] = add(prepre[i - 1], pre[i]);
    }
  }
  cout << pre[s.size()] << endl;
  return 0;
}
