#include <bits/stdc++.h>
using namespace std;
int infinito = 1000000000;
int ini = 0;
int fin;
int capacidad[1000][1000];
int coste[1000][1000];
int flujo[1000][1000];
int potencial[1000];
int costetotal = 0;
int dist[1000];
int anterior[1000];
vector<int> g[1000];
int flujocalculado = 0;
void maxflowmincost() {
  for (int i = 0; i <= fin; i++) {
    for (int j = i + 1; j <= fin; j++) {
      if (capacidad[i][j] or capacidad[j][i]) {
        g[i].push_back(j);
        g[j].push_back(i);
      }
    }
  }
  for (;;) {
    for (int i = 0; i <= fin; i++) dist[i] = infinito;
    priority_queue<pair<int, int>, vector<pair<int, int> >,
                   greater<pair<int, int> > >
        q;
    q.push(pair<int, int>(0, ini));
    dist[ini] = 0;
    while (not q.empty()) {
      pair<int, int> p = q.top();
      q.pop();
      int du = p.first;
      int u = p.second;
      if (du == dist[u]) {
        vector<int> &ar = g[u];
        for (int i = 0; i < int(ar.size()); i++) {
          int v = ar[i];
          if (flujo[u][v] >= 0 and capacidad[u][v] > flujo[u][v] and
              du + coste[u][v] + potencial[u] - potencial[v] < dist[v]) {
            dist[v] = du + coste[u][v] + potencial[u] - potencial[v];
            anterior[v] = u;
            q.push(pair<int, int>(dist[v], v));
          } else if (flujo[u][v] < 0 and
                     du - coste[v][u] + potencial[u] - potencial[v] < dist[v]) {
            dist[v] = du - coste[v][u] + potencial[u] - potencial[v];
            anterior[v] = u;
            q.push(pair<int, int>(dist[v], v));
          }
        }
      }
    }
    if (dist[fin] == infinito) return;
    for (int i = 0; i <= fin; i++) potencial[i] += dist[i];
    int u = fin;
    int bot = infinito;
    while (u != ini) {
      int antu = anterior[u];
      if (flujo[antu][u] >= 0)
        bot = min(bot, capacidad[antu][u] - flujo[antu][u]);
      else
        bot = min(bot, -flujo[antu][u]);
      u = antu;
    }
    flujocalculado += bot;
    u = fin;
    while (u != ini) {
      int antu = anterior[u];
      if (flujo[antu][u] >= 0)
        costetotal += bot * coste[antu][u];
      else
        costetotal -= bot * coste[u][antu];
      flujo[antu][u] += bot;
      flujo[u][antu] -= bot;
      u = antu;
    }
  }
}
int numbits(int x) {
  int num = 0;
  while (x > 0) {
    num += x & 1;
    x /= 2;
  }
  return num;
}
string variable[1000];
int valor[1000];
string itos(int x) {
  string s;
  while (x > 0) {
    s = string(1, char(x % 10 + '0')) + s;
    x /= 10;
  }
  return s;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> valor[i];
  int tope = 2 * n + 1;
  capacidad[0][tope] = m;
  capacidad[tope][tope + 1] = m;
  capacidad[tope + 1][tope + 2] = m;
  for (int i = 1; i <= n; i++) {
    capacidad[0][2 * i] = 1;
    capacidad[tope][2 * i - 1] = 1;
    coste[tope][2 * i - 1] = numbits(valor[i]);
    capacidad[2 * i][tope + 1] = 1;
    capacidad[2 * i - 1][tope + 2] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      capacidad[2 * i][2 * j - 1] = 1;
      if (valor[i] != valor[j]) coste[2 * i][2 * j - 1] = numbits(valor[j]);
    }
  }
  fin = tope + 2;
  maxflowmincost();
  int varsusadas = 0;
  vector<string> sol;
  for (int i = 1; i <= n; i++) {
    if (flujo[tope][2 * i - 1]) {
      variable[i] = string(1, char('a' + varsusadas));
      varsusadas++;
      sol.push_back(variable[i] + "=" + itos(valor[i]));
      sol.push_back("print(" + variable[i] + ")");
    } else {
      for (int j = 1; j < i; j++) {
        if (flujo[2 * j][2 * i - 1]) {
          variable[i] = variable[j];
          if (valor[j] != valor[i])
            sol.push_back(variable[i] + "=" + itos(valor[i]));
          sol.push_back("print(" + variable[i] + ")");
          break;
        }
      }
    }
  }
  cout << int(sol.size()) << " " << costetotal << endl;
  for (int i = 0; i < int(sol.size()); i++) {
    cout << sol[i] << endl;
  }
}
