10
-405 -230 252 -393 -390 -259 97 163 81 -129
 3
10000 -10000 10000
 1
-10000
 20
-16 -23 29 44 -40 -50 -41 34 -38 30 -12 28 -44 -49 15 50 -28 38 -2 0

702.333333333333712
 10000.000000000016371
 0.000000000000000
 113.875000000000043

#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000002;
const long long INFLL = 100000000000000000ll;
const long long MOD = 1000000007;
struct NetworkFlowWithCost {
  struct edge {
    int a, b, cap, cost;
    edge(int p1, int p2, int p3, int p4) : a(p1), b(p2), cap(p3), cost(p4){};
  };
  const int INF = 2147483647;
  int s, t;
  vector<edge> edges;
  vector<int> best, from;
  vector<vector<int>> e;
  NetworkFlowWithCost(int sz) {
    best.resize(sz + 1);
    e.resize(sz + 1);
    from.resize(sz + 1);
  }
  void setSource(int n) { s = n; }
  void setSink(int n) { t = n; }
  void addEdge(int a, int b, int _cap, int _cost) {
    edges.push_back(edge(a, b, _cap, _cost));
    e[a].push_back(((int)edges.size()) - 1);
    edges.push_back(edge(b, a, 0, -_cost));
    e[b].push_back(((int)edges.size()) - 1);
  }
  bool dijkstra() {
    fill(best.begin(), best.end(), INF);
    priority_queue<pair<int, int>, vector<pair<int, int>>,
                   greater<pair<int, int>>>
        q;
    best[s] = 0, q.push({0, s});
    while (!q.empty()) {
      pair<int, int> p = q.top();
      q.pop();
      int n = p.second, c = p.first;
      if (best[n] < c) continue;
      if (n == t) return true;
      for (int idx : e[n]) {
        edge &ed = edges[idx];
        if (ed.cap && c + ed.cost < best[ed.b]) {
          best[ed.b] = c + ed.cost;
          from[ed.b] = idx;
          q.push({best[ed.b], ed.b});
        }
      }
    }
    return best[t] < INF;
  }
  int minCostMaxFlow() {
    int c = 0;
    while (dijkstra()) {
      int ff = INF, n = t, prev = c;
      while (n != s) {
        edge &ed = edges[from[n]];
        c += ed.cost;
        ff = min(ff, ed.cap);
        n = ed.a;
      }
      n = t;
      while (n != s) {
        edge &ed = edges[from[n]];
        edge &rev = from[n] % 2 ? edges[from[n] - 1] : edges[from[n] + 1];
        ed.cap -= ff, rev.cap += ff;
        n = ed.a;
      }
    }
    return c;
  }
};
string Var[255];
int A[255], L, N;
vector<string> Ops[255];
int letter(int i) { return N + i; }
int node_left(int i) { return i; }
int node_right(int i) { return N + L + i; }
string tostr(int n) {
  if (n == 0) return "0";
  string ret;
  while (n) {
    ret += (char)(n % 10 + '0');
    n /= 10;
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
int main() {
  cin >> N >> L;
  for (int i = (1); i <= (N); i++) cin >> A[i];
  int s = 0, t = N + L + N + 1;
  NetworkFlowWithCost g(N + L + N + 2);
  g.setSource(s);
  g.setSink(t);
  for (int i = (1); i <= (N); i++)
    for (int j = (i + 1); j <= (N); j++)
      g.addEdge(node_left(i), node_right(j), 1,
                A[i] == A[j] ? 0 : __builtin_popcount(A[j]));
  for (int l = (1); l <= (L); l++)
    for (int j = (1); j <= (N); j++)
      g.addEdge(letter(l), node_right(j), 1, __builtin_popcount(A[j]));
  for (int i = (1); i <= (N); i++)
    g.addEdge(s, node_left(i), 1, 0), g.addEdge(node_right(i), t, 1, 0);
  for (int i = (1); i <= (L); i++) g.addEdge(s, letter(i), 1, 0);
  int cost = g.minCostMaxFlow(), o = 0;
  for (int i = (N + 1); i <= (N + L); i++)
    for (int idx : g.e[i]) {
      if (g.edges[idx].cap == 0 && g.edges[idx].b > N + L) {
        char l = (char)('a' + i - N - 1);
        int j = g.edges[idx].b - N - L;
        Var[j] = l;
        Ops[j].push_back(Var[j] + "=" + tostr(A[j]));
        Ops[j].push_back("print(" + Var[j] + ")");
        o++;
      }
    }
  for (int i = (1); i <= (N); i++)
    for (int idx : g.e[i]) {
      if (g.edges[idx].b > N + L && g.edges[idx].cap == 0) {
        int j = g.edges[idx].b - N - L;
        if (A[i] != A[j]) Ops[j].push_back(Var[i] + "=" + tostr(A[j])), o++;
        Ops[j].push_back("print(" + Var[i] + ")");
        Var[j] = Var[i];
      }
    }
  cout << o + N << " " << cost << "\n";
  for (int i = (1); i <= (N); i++)
    for (string s : Ops[i]) cout << s << "\n";
}
