#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, f, p = -1, sum = 0, ans = 1;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    if (a >= n - k + 1) {
      if (p != -1) ans = ans * (i - p) % 998244353;
      sum += a;
      p = i;
    }
  }
  cout << sum << " " << ans;
  return 0;
}
