#include <bits/stdc++.h>
using namespace std;
int F[100005];
int mark[100005];
int nearest[100005];
long long dp1[100005];
long long dp2[100005];
string s;
string hay;
void buildPrefix() {
  F[0] = 0;
  F[1] = 0;
  int n = s.size();
  for (int i = 2; i <= n; i++) {
    int j = F[i - 1];
    char c = s[i - 1];
    while (true) {
      if (c == s[j]) {
        F[i] = j + 1;
        break;
      }
      if (j == 0) {
        F[i] = 0;
        break;
      }
      j = F[j];
    }
  }
}
void kmp() {
  int len = hay.size();
  int j = 0;
  int i = 0;
  while (i < len) {
    if (hay[i] == s[j]) {
      if (j == s.size() - 1) {
        mark[i] = 1;
      }
      j++;
      i++;
      continue;
    }
    if (j == 0) {
      i++;
      continue;
    }
    j = F[j];
  }
}
int main() {
  cin >> hay >> s;
  buildPrefix();
  kmp();
  int l1 = hay.size();
  int l2 = s.size();
  long long ans = 0;
  nearest[l1] = l1 + 1;
  for (int i = l1 - 1; i >= 0; i--) {
    if (i + l2 - 1 < l1 && mark[i + l2 - 1] == 1) {
      nearest[i] = (i + l2);
    } else {
      nearest[i] = nearest[i + 1];
    }
  }
  dp2[l1] = 1;
  dp1[l1] = 1;
  for (int i = l1 - 1; i >= 0; i--) {
    long long temp = 0;
    if (nearest[i] == l1 + 1) {
      temp = 0;
    } else {
      temp = (temp + dp2[nearest[i]]) % 1000000007;
    }
    ans = (ans + temp) % 1000000007;
    dp1[i] = (dp1[i + 1] + temp) % 1000000007;
    dp2[i] = (dp1[i] + dp2[i + 1]) % 1000000007;
  }
  cout << ans << endl;
}
