#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 998244353;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> pos;
  ll ans = 0;
  ll ways = 1;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a > n - k) {
      ans += a;
      pos.push_back(i);
    }
  }
  for (int i = 0; i + 1 < (int)pos.size(); i++) {
    ways *= pos[i + 1] - pos[i];
    ways %= MOD;
  }
  cout << ans << ' ' << ways << '\n';
}
