#include <bits/stdc++.h>
using namespace std;
const int MAX_LENGTH = 1 << 20;
const int MOD = 1000000007;
const unsigned long long HASH_MUL = 31ULL;
char s1[MAX_LENGTH], s2[MAX_LENGTH];
int main() {
  scanf("%s%s", s1, s2);
  int n = strlen(s1);
  int m = strlen(s2);
  if (m > n) {
    std::cout << "0" << std::endl;
    return 0;
  }
  vector<unsigned long long> hash, base;
  vector<bool> flag;
  hash.resize(n + 1), base.resize(n + 1), flag.resize(n + 1);
  for (int i = 0; i < n + 1; i++) {
    flag[i] = false;
  }
  hash[0] = 0, base[0] = 1ULL;
  for (int i = 1; i <= n; i++) {
    hash[i] = hash[i - 1] + (unsigned long long)(s1[i - 1] - 'a') * base[i - 1];
    base[i] = base[i - 1] * HASH_MUL;
  }
  unsigned long long hash_a = hash[n], hash_b = 0ULL;
  for (int i = 0; i < m; i++) {
    hash_b = hash_b + (unsigned long long)(s2[i] - 'a') * base[i];
  }
  flag[0] = false;
  for (int i = m; i <= n; i++) {
    if ((hash[i] - hash[i - m]) == hash_b * base[i - m]) {
      flag[i] = true;
    }
  }
  vector<unsigned long long> dp1, dp2, sum;
  dp1.resize(n + 1), dp2.resize(n + 1), sum.resize(n + 1);
  dp1[0] = 0, dp2[0] = 0, sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (flag[i]) {
      dp1[i] = sum[i - m] + i - m + 1;
    } else {
      dp1[i] = dp1[i - 1];
    }
    dp2[i] = dp2[i - 1] + dp1[i];
    sum[i] = sum[i - 1] + dp2[i];
    dp1[i] = dp1[i] % MOD;
    dp2[i] = dp2[i] % MOD;
    sum[i] = sum[i] % MOD;
  }
  std::cout << dp2[n] << std::endl;
  return 0;
}
