#include <bits/stdc++.h>
using namespace std;
const int MAXI = numeric_limits<int>::max() / 2;
const int MINI = numeric_limits<int>::min() / 2;
const long long MAXL = numeric_limits<long long>::max() / 2;
const long long MINL = numeric_limits<long long>::min() / 2;
static const int N = 100001, MOD = 1000000007;
int nex[N];
bool good[N];
long long dp[3][N];
int n, m;
string s, t;
void getNext() {
  nex[0] = 0;
  int i = 0, j = 1;
  while (j < m) {
    if (t[j] == t[i])
      nex[j++] = ++i;
    else {
      if (i == 0)
        nex[j++] = 0;
      else
        i = nex[i - 1];
    }
  }
}
void KMP() {
  getNext();
  int i = 0, j = 0;
  while (i < n && j < m) {
    if (s[i] == t[j]) {
      ++i;
      ++j;
    }
    if (j == m) {
      good[i] = true;
      j = nex[j - 1];
    } else if (i < n && s[i] != t[j]) {
      if (j == 0)
        ++i;
      else
        j = nex[j - 1];
    }
  }
}
int main(int argc, char* argv[]) {
  cin >> s >> t;
  n = s.size();
  m = t.size();
  KMP();
  int i;
  long long ans = 0;
  for ((i) = (1); (i) < (n + 1); ++(i)) {
    if (good[i]) {
      dp[0][i] = dp[2][i - m] + i - m + 1;
    } else
      dp[0][i] = dp[0][i - 1];
    if (dp[0][i] >= MOD) dp[0][i] %= MOD;
    ans += dp[0][i];
    if (ans >= MOD) ans %= MOD;
    dp[1][i] = dp[1][i - 1] + dp[0][i];
    if (dp[1][i] >= MOD) dp[1][i] %= MOD;
    dp[2][i] = dp[2][i - 1] + dp[1][i];
    if (dp[2][i] >= MOD) dp[2][i] %= MOD;
  }
  cout << ans << endl;
  return 0;
}
