#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  int p, prev = -1;
  long long ways = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> p;
    if (p >= n - k + 1) {
      if (prev != -1) ways = (ways * (i - prev)) % MOD;
      prev = i;
    }
  }
  long long sum = 1ll * k * (2 * n - k + 1) / 2;
  cout << sum << " " << ways << '\n';
  return 0;
}
