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