#include <bits/stdc++.h>
using namespace std;
const int mxN = 2e5;
const int MOD = 1e9 + 7;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, i, sum = 0, x, mods = 998244353;
  cin >> n >> k;
  vector<long long> pos;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x > (n - k)) {
      sum += x;
      pos.push_back(i);
    }
  }
  if (0) {
    for (auto x : pos) cout << x << " ";
    cout << "\n";
  }
  long long combo = 1, c = 0;
  for (i = 1; i < pos.size(); i++) {
    combo *= pos[i] - pos[i - 1];
    combo %= mods;
  }
  cout << sum << " " << combo << "\n";
}
