#include <bits/stdc++.h>
using namespace std;
long long M = 998244353, a[250001], b[250001], n, i, k, l, ans1, ans2;
long long mod(long long a) { return a % M; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = n - k + 1; i <= n; i++) ans1 += i;
  ans2 = 1;
  for (i = 1; i <= n; i++)
    if (a[i] >= n - k + 1) {
      l++;
      b[l] = i;
    }
  for (i = 1; i <= l - 1; i++) ans2 = mod(ans2 * (b[i + 1] - b[i]));
  cout << ans1 << " " << ans2 << '\n';
  return 0;
}
