#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long int n, k;
  cin >> n >> k;
  vector<string> v[10000];
  string s;
  string pass;
  for (int i = 0; i < n; i++) {
    cin >> s;
    v[s.size()].push_back(s);
  }
  cin >> pass;
  long long int len = pass.size();
  long long int sum = 0;
  for (int i = 1; i < len; i++) {
    sum += v[i].size();
  }
  long long int ans = sum / k;
  ans *= 5;
  long long int mini = ans + sum + 1;
  sum += v[len].size();
  if (sum % k == 0)
    ans = sum / k - 1;
  else
    ans = sum / k;
  ans *= 5;
  long long int maxi = ans + sum;
  cout << mini << " " << maxi << "\n";
  return 0;
}
