using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    double Fun(double x, double y, double z)
    {
        return z * Math.Log(y) + Math.Log(Math.Log(x));
    }

    double Fun2(double x, double y, double z)
    {
        return Math.Log(y) + Math.Log(z) + Math.Log(Math.Log(x));
    }

    double Fun3(double x, double y, double z)
    {
        return Math.Pow(x, Math.Pow(y, z));
    }

    double Fun4(double x, double y, double z)
    {
        return Math.Pow(Math.Pow(x, y), z);
    }

    public void Solve()
    {
        double x = ReadDouble();
        double y = ReadDouble();
        double z = ReadDouble();

        double max = double.MinValue;
        string ans = "";
        Action<double, string> act = (v, s) =>
        {
            if (v > max)
            {
                max = v;
                ans = s;
            }
        };
        if (x < 1 && y < 1 && z < 1)
        {
            act(Fun3(x, y, z), "x^y^z");
            act(Fun3(x, z, y), "x^z^y");
            act(Fun4(x, y, z), "(x^y)^z");
            act(Fun4(x, z, y), "(x^z)^y");
            act(Fun3(y, x, z), "y^x^z");
            act(Fun3(y, z, x), "y^z^z");
            act(Fun4(y, x, z), "(y^x)^z");
            act(Fun4(y, z, x), "(y^z)^x");
            act(Fun3(z, x, y), "z^x^y");
            act(Fun3(z, y, x), "z^y^x");
            act(Fun4(z, x, y), "(z^x)^y");
            act(Fun4(z, y, x), "(z^y)^x");
            Write(ans);
            return;
        }

        if (x >= 1)
        {
            act(Fun(x, y, z), "x^y^z");
            act(Fun(x, z, y), "x^z^y");
            act(Fun2(x, y, z), "(x^y)^z");
            act(Fun2(x, z, y), "(x^z)^y");
        }
        if (y >= 1)
        {
            act(Fun(y, x, z), "y^x^z");
            act(Fun(y, z, x), "y^z^z");
            act(Fun2(y, x, z), "(y^x)^z");
            act(Fun2(y, z, x), "(y^z)^x");
        }
        if (z >= 1)
        {
            act(Fun(z, x, y), "z^x^y");
            act(Fun(z, y, x), "z^y^x");
            act(Fun2(z, x, y), "(z^x)^y");
            act(Fun2(z, y, x), "(z^y)^x");
        }

        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    double Fun(double x, double y, double z)
    {
        return z * Math.Log(y) + Math.Log(Math.Log(x));
    }

    double Fun2(double x, double y, double z)
    {
        return Math.Log(y) + Math.Log(z) + Math.Log(Math.Log(x));
    }

    double Fun3(double x, double y, double z)
    {
        return Math.Pow(x, Math.Pow(y, z));
    }

    double Fun4(double x, double y, double z)
    {
        return Math.Pow(Math.Pow(x, y), z);
    }

    public void Solve()
    {
        double x = ReadDouble();
        double y = ReadDouble();
        double z = ReadDouble();

        double max = double.MinValue;
        string ans = "";
        Action<double, string> act = (v, s) =>
        {
            if (v > max + 1e-9)
            {
                max = v;
                ans = s;
            }
        };
        if (x <= 1 && y <= 1 && z <= 1)
        {
            act(Fun3(x, y, z), "x^y^z");
            act(Fun3(x, z, y), "x^z^y");
            act(Fun4(x, y, z), "(x^y)^z");
            act(Fun4(x, z, y), "(x^z)^y");
            act(Fun3(y, x, z), "y^x^z");
            act(Fun3(y, z, x), "y^z^x");
            act(Fun4(y, x, z), "(y^x)^z");
            act(Fun4(y, z, x), "(y^z)^x");
            act(Fun3(z, x, y), "z^x^y");
            act(Fun3(z, y, x), "z^y^x");
            act(Fun4(z, x, y), "(z^x)^y");
            act(Fun4(z, y, x), "(z^y)^x");
            Write(ans);
            return;
        }

        if (x > 1)
        {
            act(Fun(x, y, z), "x^y^z");
            act(Fun(x, z, y), "x^z^y");
            act(Fun2(x, y, z), "(x^y)^z");
            act(Fun2(x, z, y), "(x^z)^y");
        }
        if (y > 1)
        {
            act(Fun(y, x, z), "y^x^z");
            act(Fun(y, z, x), "y^z^x");
            act(Fun2(y, x, z), "(y^x)^z");
            act(Fun2(y, z, x), "(y^z)^x");
        }
        if (z > 1)
        {
            act(Fun(z, x, y), "z^x^y");
            act(Fun(z, y, x), "z^y^x");
            act(Fun2(z, x, y), "(z^x)^y");
            act(Fun2(z, y, x), "(z^y)^x");
        }

        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


// Codeforces.ConsoleTemplate.CSharp
// https://www.nuget.org/packages/Codeforces.ConsoleTemplate.CSharp

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace B
{
    public class Solution
    {
        public void Execute()
        {
            var (n, m) = ReadTwoInt;
            var a = ReadInts;

            var dic = new Dictionary<int, int>();
            foreach(var x in a)
            {
                if (!dic.ContainsKey(x)) dic[x] = 1;
                else ++dic[x];
            }

            var b = dic.Values.ToArray();
            Array.Sort(b);
            var result = 0;
            for (var i = 1; i <= m; ++i)
            {
                if (Check(b, n, i)) result = i;
                else break;
            }

            WriteLine(result);
        }

        private bool Check(int[] b, int n, int day)
        {
            var total = 0;
            b.ForEach(x => total += x / day);

            return total >= n;
        }

        private StreamReader reader;
        private StreamWriter writer;

        public Solution(StreamReader reader, StreamWriter writer)
        {
            this.reader = reader;
            this.writer = writer;
        }

        private string ReadLine => reader.ReadLine();
        private int ReadInt => ReadLine.ToInt();
        private long ReadLong => ReadLine.ToLong();
        private double ReadDouble => ReadLine.ToDouble();
        private T Read<T>() => (T)Convert.ChangeType(ReadLine, typeof(T));

        private (T, T) ReadTwo<T>(char c = ' ') => Reads<T>(c).ToTwoTuple();
        private (int, int) ReadTwoInt => ReadTwo<int>();
        private (long, long) ReadTwoLong => ReadTwo<long>();
        private (double, double) ReadTwoDouble => ReadTwo<double>();

        private (T, T, T) ReadThree<T>(char c = ' ') => Reads<T>(c).ToThreeTuple();
        private (int, int, int) ReadThreeInt => ReadThree<int>();
        private (long, long, long) ReadThreeLong => ReadThree<long>();
        private (double, double, double) ReadThreeDouble => ReadThree<double>();

        private string[] Split(char c = ' ') => ReadLine.Split(c);
        private T[] Reads<T>(char c = ' ') => Split(c).Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();
        private int[] ReadInts => Split().Select(int.Parse).ToArray();
        private long[] ReadLongs => Split().Select(long.Parse).ToArray();
        private double[] ReadDoubles => Split().Select(double.Parse).ToArray();

        private void Write<T>(T s) => writer.Write(s);
        private void WriteLine<T>(T s) => writer.WriteLine(s);

        private static T SetGreater<T>(ref T a, ref T b) where T : IComparable
        {
            SetLess(ref b, ref a);
            return a;
        }

        private static T SetLess<T>(ref T a, ref T b) where T : IComparable
        {
            if (a.CompareTo(b) > 0)
            {
                Swap(ref a, ref b);
            }
            return a;
        }

        private static void Swap<T>(ref T a, ref T b)
        {
            var temp = b;
            b = a;
            a = temp;
        }
    }

    public class Program
    {
        public static void Main(string[] args)
        {
            CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;

            // Change the stack size to avoid stack overflow.
            // e.g. stackSizeMb = 128.
            var stackSizeMb = 0;

            if (args.Length > 0 && args.First() == "test")
            {
                if (args.Length > 1)
                {
                    Test(args[1], true);
                }
                else
                {
                    for (var i = 0; i < 10 && Test(i.ToString()); ++i);
                }
            }
            else
            {
                var reader = new StreamReader(Console.OpenStandardInput());
                var writer = new StreamWriter(Console.OpenStandardOutput());
                Run(reader, writer, stackSizeMb);
            }
        }

        private static bool Test(string name, bool show = false)
        {
            var test = $"in{name}.txt";
            if (File.Exists(test))
            {
                var reader = new StreamReader(test);
                var output = new MemoryStream();
                var writer = new StreamWriter(output);
                Run(reader, writer);

                var expect = new StreamReader($"out{name}.txt").ReadToEnd()
                    .Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
                var actual = Encoding.UTF8.GetString(output.ToArray());

                if (show)
                {
                    Console.WriteLine(actual);
                }

                if (actual.TrimEnd() == expect.TrimEnd())
                {
                    WriteLine($"Test {name} passed.", ConsoleColor.Green);
                }
                else
                {
                    WriteLine($"Test {name} failed.", ConsoleColor.Red);
                }

                return true;
            }
            return false;
        }

        private static void Run(StreamReader reader, StreamWriter writer, int stackSize = 0)
        {
            var solution = new Solution(reader, writer);
            if (stackSize == 0)
            {
                solution.Execute();
            }
            else
            {
                var thread = new Thread(solution.Execute, stackSize * 1024 * 1024);
                thread.Start();
                thread.Join();
            }
            writer.Flush();
        }

        private static void WriteLine(string s, ConsoleColor color)
        {
            Console.ForegroundColor = color;
            Console.WriteLine(s);
            Console.ResetColor();
        }
    }

    public static class Extensions
    {
        public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
        {
            foreach(T item in enumeration)
            {
                action(item);
            }
        }

        public static (T, T) ToTwoTuple<T>(this IList<T> list) => (list[0], list[1]);
        public static (T, T, T) ToThreeTuple<T>(this IList<T> list) => (list[0], list[1], list[2]);
        public static int ToInt(this string s) => int.Parse(s);
        public static long ToLong(this string s) => long.Parse(s);
        public static double ToDouble(this string s) => double.Parse(s);
        public static string Merge<T>(this IEnumerable<T> enumeration, string split = " ") => string.Join(split, enumeration);
    }
}


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {
        int n = Console.ReadLine().Split().Select(int.Parse).First();
        int[] aa = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Dictionary<int, int> adic = new Dictionary<int, int>();
        for (int i = 0; i < aa.Length; i++)
        {
            if (!adic.ContainsKey(aa[i])) adic.Add(aa[i], 0);
            adic[aa[i]]++;
        }
        int[] a = adic.Values.ToArray();
        for (int i = 1; i <= int.MaxValue; i++)
        {
            if (a.Where(x => x >= i).Select(x => x / i).Sum() < n)
            {
                Console.WriteLine(i - 1);
                return;
            }
        }
        //Console.WriteLine(a.Length < n ? 0 : a.Min());
    }
}


#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;

#if DEBUG
using System.Diagnostics;
#endif

namespace _499b
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;
        const string _delim = "!";

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
            var testNumber = 0;
            var timer = new Stopwatch();
            foreach (var test in GetTests())
            {

                timer.Start();

                var defaultColor = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine($"<!-- TEST #{testNumber} -->");
                Console.ForegroundColor = defaultColor;
                Console.SetIn(test);

#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                Solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }

#if DEBUG
                timer.Stop();

                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine($"<!-- TEST #{testNumber} FINISHED IN {timer.Elapsed.ToString(@"ss\:fff")}-->");
                Console.ForegroundColor = defaultColor;

                timer.Reset();
                testNumber++;
            }
#endif
        }

        static void Solution()
        {
            #region SOLUTION

            var d = ReadIntArray();
            var n = d[0];
            var m = d[1];
            var a = ReadIntArray();
            var ts = new Dictionary<int, int>();
            for (int i = 0; i < m; i++)
            {
                var nt = a[i];
                if (!ts.ContainsKey(nt))
                {
                    ts[nt] = 0;
                }

                ts[nt]++;
            }

            var tts = ts.Values.ToArray();
            var r = 1000 * 1000;
            var l = 0;
            while (true)
            {
                if (l == r)
                {
                    break;
                }

                //Console.WriteLine("{0} {1}", l, r);
                var mid = l + (r - l + 1) / 2;

                if (mid == 3)
                {

                }
                var canSr = 0;
                for (int i = 0; i < tts.Length; i++)
                {
                    var count = tts[i];
                    canSr += count / mid;
                }

                if (canSr >= n)
                {
                    l = mid;
                }
                else
                {
                    r = mid - 1;
                }
            }

            Console.WriteLine(l);
            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
        static IEnumerable<TextReader> GetTests()
        {
            var tests = new List<string>();
            var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
            using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))
            {
                while (true)
                {
                    var nextText = new StringBuilder();
                    var endOfFile = false;
                    while (true)
                    {
                        var line = resource.ReadLine();

                        endOfFile = line == null;
                        if (endOfFile)
                        {
                            break;
                        }

                        if (line.Equals(_delim, StringComparison.Ordinal))
                        {
                            break;
                        }

                        nextText.AppendLine(line);
                    }

                    yield return new StringReader(nextText.ToString());

                    if (endOfFile)
                    {
                        break;
                    }
                }
            }
        }
#endif
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CF1012A
{
    class Program
    {
        public static int _cmp(int a,int b) {
            if (a == b) return 0;
            else if (a > b) return -1;
            else return 1;
        }

        public static bool canSolve(int[] food, int days, int totPeo) {
            int now = 0;
            while (totPeo > 0) {
                while (food[now] < days)
                    if (++now > 100) return false;
                food[now] -= days;
                totPeo--;
            }
            return true;
        }

        static void Main(string[] args)
        {
            int totNums, totParticipant;

            string inp = Console.ReadLine(); string[] div;
            div = inp.Split(' ');
            totNums = Convert.ToInt32(div[1]);totParticipant = Convert.ToInt32(div[0]);

            int[] num = new int[101];
            for (int i = 0; i < 101; i++) num[i] = 0;
            inp = Console.ReadLine();div = inp.Split(' ');
            for (int i = 0; i < totNums; i++)
                num[Convert.ToInt32(div[i]) - 1]++;

            Array.Sort(num, _cmp);
            //for (int i = 0; i < totNums && num[i] > 0; i++)
            //    Console.Write("{0} ", num[i]);

            int fr = 0, to = 101, mid;
            int[] fd = new int[101];
            while (fr < to) {
                mid = ((fr + to) >> 1) + 1;
                for (int i = 0; i < 101; i++) fd[i] = num[i];
                if (canSolve(fd, mid, totParticipant)) fr = mid;
                else to = mid - 1;
            }
            Console.WriteLine(fr.ToString());
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Program
    {

        static bool ok(int k, int n, int[] a)
        {
            int cant = 0;
            int m = a.Length;
            for (int i = 0; i < m; i++)
                cant += a[i] / k;
            return cant >= n;
        }

        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            int n = int.Parse(line[0]);
            int m = int.Parse(line[1]);
            line = Console.ReadLine().Split(' ');
            int[] a = new int[m];
            for (int i = 0; i < m; i++)
                a[i] = int.Parse(line[i]);
            int[] b = new int[105];
            for (int i = 0; i < m; i++)
                b[a[i]]++;

            int ans = 0;
            int lo = 1;
            int hi = m;
            while(lo <= hi)
            {
                int mid = (lo + hi) >> 1;
                if(ok(mid, n, b))
                {
                    ans = mid;
                    lo = mid + 1;
                }
                else
                {
                    hi = mid - 1;
                }
            }

            Console.WriteLine(ans);

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

namespace CF_1011B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arrEatType = new int[101];

            var input = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            int participant = input[0];
            int amount = input[1];

            List<int> arrEat = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).ToList();

            for (int i = 0; i < amount; ++i)
            {
                arrEatType[arrEat[i]]++;
            }

            Array.Sort(arrEatType);
            Array.Reverse(arrEatType);

            for(int i=amount;i>0;i--)
            {
                int temp = 0;

                for(int j=0;j<=amount;j++)
                {
                    temp += arrEatType[j] / i;
                }

                if(temp>= participant)
                {
                    Console.WriteLine(i);
                    return;
                }
            }

            Console.WriteLine(0);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using static Template;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pi = Pair<int, int>;

class Solver
{
    Scanner sc = new Scanner();
    //

    public void Solve()
    {
        int n, m;
        sc.Make(out n, out m);
        var ct = new int[101];
        for (var i = 0; i < m; i++)
            ct[sc.Next<int>()]++;
        Array.Sort(ct, (a, b) => b - a);

        var r = 101; var l = 0;
        while (r - l > 1)
        {
            var mi = (r + l) / 2;
            bool ok;
            //判定
            var c = 0;
            for (var i = 0; i < n; i++)
                c += ct[i] / mi;
            ok = c < n;
            if (ok) r = mi;
            else l = mi;
        }
        WriteLine(l);
    }
}

#region Template
public class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T num, T val) where T : IComparable<T>
    { if (num.CompareTo(val) == 1) { num = val; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T num, T val) where T : IComparable<T>
    { if (num.CompareTo(val) == -1) { num = val; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T v1, ref T v2)
    { var t = v2; v2 = v1; v1 = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f();
        return rt;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<int, T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f(i);
        return rt;
    }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}

public class Scanner
{
    public string Str => ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    public Pair<T1, T2> PairMake<T1, T2>() => new Pair<T1, T2>(Next<T1>(), Next<T2>());
    public Pair<T1, T2, T3> PairMake<T1, T2, T3>() => new Pair<T1, T2, T3>(Next<T1>(), Next<T2>(), Next<T3>());
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
}

public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString()
        => $"{v1.ToString()} {v2.ToString()}";
    public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString()
        => $"{base.ToString()} {v3.ToString()}";
    public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }
}
#endregion


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

public class Solution
{
    int mod;

    long Fun(int n)
    {
        var dp = new long[n + 1];
        dp[1] = 1;
        long sum = 1;
        var pdp = new long[n + 1];
        for (int i = 1; i <= n; i++)
        {
            pdp[i] = (pdp[i] + pdp[i - 1]) % mod;
            dp[i] = (sum + pdp[i]) % mod;

            for (int j = i * 2, k = 2; j <= n; j += i, k++)
            {
                pdp[j] = (pdp[j] + dp[i]) % mod;
                if (j + k <= n)
                    pdp[j + k] = (pdp[j + k] + mod - dp[i]) % mod;
            }

            if (i > 1)
                sum = (sum + dp[i]) % mod;
        }
        return dp[n];
    }

    public void Solve()
    {
        int n = ReadInt();
        mod = ReadInt();
        Write(Fun(n));
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUGLOCAL
        reader = new StreamReader("..\\..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("ysys.in");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            new Solution().Solve();
            //var thread = new Thread(new Solution().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
#if DEBUGLOCAL
            Console.WriteLine(ex);
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array) writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }
    #endregion
}


using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;

class Program
{
    class MUMU
    {
        public long Val;
        public int Ind;
    }

    //////////////////////////////////////////////////
    void Solution()
    {
        var n = ri;
        var a = new List<MUMU>(n);
        for (int i = 0; i < n; i++)
            a.Add(new MUMU { Val = rl, Ind = i });
        a.Sort((x, y) => x.Val.CompareTo(y.Val));
        var b = new List<MUMU>(n);
        for (int i = 1; i < n; i++)
            b.Add(a[i]);
        b.Add(a[0]);
        for (int i = 0; i < n-1; i++)
        {
            for (int j = 0; j < n-1; j++)
            {
                if (a[j].Ind > a[j + 1].Ind)
                {
                    var buf = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = buf;
                    buf = b[j];
                    b[j] = b[j + 1];
                    b[j + 1] = buf;
                }
            }
        }

        for (int i = 0; i < n; i++)
            wsp(b[i].Val);
    }
    //////////////////////////////////////////////////

    static void swap<T>(ref T o1, ref T o2) { var o = o1; o1 = o2; o2 = o; }

    static void wln() { Console.WriteLine(); }
    static void wln<T>(T o) { Console.WriteLine(o); }
    static void wsp<T>(T o) { Console.Write(o + " "); }
    static void wrt<T>(T o) { Console.Write(o); }

    static void wln(double o) { Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0:F12}", o)); }
    static void wsp(double o) { Console.Write(string.Format(CultureInfo.InvariantCulture, "{0:F12} ", o)); }
    static void wrt(double o) { Console.Write(string.Format(CultureInfo.InvariantCulture, "{0:F12}", o)); }

    static long gcd(long a, long b) { return (b != 0) ? gcd(b, a % b) : a; }
    static long lcm(long a, long b) { return a / gcd(a, b) * b; }

    int ri
    {
        get
        {
            _read(); while (_str[_ind] == ' ') ++_ind;
            int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }
            int p = 0;
            while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';
            while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;
        }
    }
    long rl
    {
        get
        {
            _read(); while (_str[_ind] == ' ') ++_ind;
            int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }
            long p = 0;
            while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';
            while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;
        }
    }
    double rd
    {
        get
        {
            _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }
            long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';
            if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }
            while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;
        }
    }
    string rs
    {
        get
        {
            _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;
            var tmp = _str.IndexOf(' ', _ind);
            if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }
            var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;
            while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;
        }
    }

    int[] ria(int n)
    {
        var res = new int[n];
        for (int k = 0; k < n;)
        {
            var s = Console.ReadLine(); var m = s.Length;
            for (int i = 0; i < m && k < n; ++i)
            {
                while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }
                int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;
            }
        }
        _count = 0; _ind = 0; return res;
    }
    long[] rla(int n)
    {
        var res = new long[n];
        for (int k = 0; k < n;)
        {
            var s = Console.ReadLine(); var m = s.Length;
            for (int i = 0; i < m && k < n; ++i)
            {
                while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }
                long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;
            }
        }
        _count = 0; _ind = 0; return res;
    }
    double[] rda(int n)
    {
        var res = new double[n];
        for (int k = 0; k < n;)
        {
            var s = Console.ReadLine(); var m = s.Length;
            for (int i = 0; i < m && k < n; ++i)
            {
                while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }
                long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';
                if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }
                res[k++] = (double)p / q * sign;
            }
        }
        _count = 0; _ind = 0; return res;
    }
    string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }
    string _str = null; int _count = 0; int _ind = 0;
    void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }
    static void Main()
    {
        //Console.SetIn(new StreamReader("input.txt"));
        //Console.SetOut(new StreamWriter("output.txt"));
        new Program().Solution();
        //Console.In.Close();
        //Console.Out.Close();
    }
}


using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    ReadData re;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        re = new ReadData();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = re.i();
        long[] A = re.la();
        Compression Comp = new Compression(A);
        for(int i=0;i<N;i++){
            int p = Comp.ToPoint(A[i])+1;
            if(p == N){
                p = 0;
            }
            sb.Append(Comp.A[p]);
            if(i == N-1){
                sb.Append("\n");
            }
            else{
                sb.Append(" ");
            }
        }
    }
}
class Compression{
    public int size;
    public long[] A;
    public Compression(long[] a){
        long[] b = new long[a.Length];
        for(int i=0;i<a.Length;i++){
            b[i] = a[i];
        }
        a = b;
        Array.Sort(a);
        List<long> AL = new List<long>();
        AL.Add(a[0]);
        for(int i=1;i<a.Length;i++){
            if(a[i] != a[i-1]){
                AL.Add(a[i]);
            }
        }
        A = AL.ToArray();
        size = A.Length;
    }
    public int ToPoint(long X){
        int bf = 0;
        int bl = size-1;
        while(bf != bl){
            int bc = (bf+bl)/2;
            if(A[bc] >= X){
                bl = bc;
            }
            else{
                bf = bc+1;
            }
        }
        return bf;
    }
    public long Value(int i){
        return A[i];
    }
}
class ReadData{
    string[] str;
    int counter;
    public ReadData(){
        counter = 0;
    }
    public string s(){
        if(counter == 0){
            str = Console.ReadLine().Split(' ');
            counter = str.Length;
        }
        counter--;
        return str[str.Length-counter-1];
    }
    public int i(){
        return int.Parse(s());
    }
    public long l(){
        return long.Parse(s());
    }
    public double d(){
        return double.Parse(s());
    }
    public int[] ia(int N){
        int[] ans = new int[N];
        for(int j=0;j<N;j++){
            ans[j] = i();
        }
        return ans;
    }
    public int[] ia(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        int[] ans = new int[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = int.Parse(str[j]);
        }
        return ans;
    }
    public long[] la(int N){
        long[] ans = new long[N];
        for(int j=0;j<N;j++){
            ans[j] = l();
        }
        return ans;
    }
    public long[] la(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        long[] ans = new long[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = long.Parse(str[j]);
        }
        return ans;
    }
    public double[] da(int N){
        double[] ans = new double[N];
        for(int j=0;j<N;j++){
            ans[j] = d();
        }
        return ans;
    }
    public double[] da(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        double[] ans = new double[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = double.Parse(str[j]);
        }
        return ans;
    }
    public List<int>[] g(int N,int[] f,int[] t){
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<f.Length;j++){
            ans[f[j]].Add(t[j]);
            ans[t[j]].Add(f[j]);
        }
        return ans;
    }
    public List<int>[] g(int N,int M){
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<M;j++){
            int f = i()-1;
            int t = i()-1;
            ans[f].Add(t);
            ans[t].Add(f);
        }
        return ans;
    }
    public List<int>[] g(){
        int N = i();
        int M = i();
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<M;j++){
            int f = i()-1;
            int t = i()-1;
            ans[f].Add(t);
            ans[t].Add(f);
        }
        return ans;
    }
}
public static class Define{
    public const long mod = 1000000007;
}
public static class Debug{
    public static void Print(double[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(double[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(double[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
    public static void Print(long[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(long[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(long[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
    public static void Print(int[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(int[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(int[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using CompLib.Util;

public class Program
{
    int N, M;
    int[] K;

    HashSet<int>[] S;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        M = sc.NextInt();

        K = sc.IntArray();
        S = new HashSet<int>[400001];
        for (int i = 0; i <= 400000; i++)
        {
            S[i] = new HashSet<int>();
        }
        for (int i = 0; i < M; i++)
        {
            int d = sc.NextInt();
            int t = sc.NextInt() - 1;
            S[d].Add(t);
        }

        /*
         * 毎日1B獲得
         *
         * n種類
         * 通常2B
         * セール1B
         *
         * タイプiをK_i個
         *
         * m個
         *
         * タイプt_iがd_iにセール
         *
         * 全部買う　最小日数
         */

        /*
         * i日で達成できるか?
         *
         * 最後から見る
         *
         */
        int ok = 400000;
        int ng = 0;
        while (ok - ng > 1)
        {
            int mid = (ok + ng) / 2;
            if (F(mid)) ok = mid;
            else ng = mid;
        }
        Console.WriteLine(ok);

    }

    // t日でできるか?
    bool F(int t)
    {
        int[] tmp = new int[N];
        Array.Copy(K, tmp, N);

        int[] cnt = new int[N];
        for (int i = 1; i <= t; i++)
        {
            foreach (int type in S[i])
            {
                cnt[type]++;
            }
        }
        int b = 0;
        for (int i = 1; i <= t; i++)
        {
            b++;
            foreach (var type in S[i])
            {
                if (cnt[type] == 1)
                {
                    int min = Math.Min(b, tmp[type]);
                    b -= min;
                    tmp[type] -= min;
                }
                cnt[type]--;
            }

        }

        long sum = 0;
        foreach (var i in tmp)
        {
            sum += i;
        }

        return sum * 2 <= b;
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using SB = System.Text.StringBuilder;
//using System.Threading.Tasks;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
using System.Numerics;
using static System.Math;
using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    readonly int dom = 998244353;
    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    bool calc(int day, int[] K, List<int>[] L, int Sum)
    {
        int used = 0;
        int money = day;
        for (int i = day - 1; i >= 0; i--)
        {
            if (i < L.Length)
            {
                foreach (var v in L[i])
                {
                    int buy = Min(K[v], money);
                    money -= buy;
                    K[v] -= buy;
                    used += buy;
                }
            }
            money = Min(i, money);
        }

        int remain = Sum - used;

        return remain * 2 <= (day - used);

    }
    void solve()
    {
        int N = cin.nextint;
        int M = cin.nextint;
        var K = cin.scanint;

        var L = new List<int>[200000];
        for (int i = 0; i < L.Length; i++)
        {
            L[i] = new List<int>();
        }
        for (int i = 0; i < M; i++)
        {
            L[cin.nextint - 1].Add(cin.nextint - 1);
        }
        int Sum = K.Sum();

        int ng = 0;
        int ok = Sum * 2;
        while (ok - ng > 1)
        {
            int mid = (ok + ng) / 2;

            var Z = new int[N];
            for (int i = 0; i < Z.Length; i++)
            {
                Z[i] = K[i];
            }

            if (calc(mid, Z, L, Sum))
            {
                ok = mid;
            }
            else
            {
                ng = mid;
            }
        }

        WriteLine(ok);

    }

}

static class Ex
{
    public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values));
    public static string concat<T>(this IEnumerable<T> values) => string.Concat(values);
    public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }

    public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) < 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
    public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) <= 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}

class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
{
    public T f; public U s;
    public Pair(T f, U s) { this.f = f; this.s = s; }
    public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);
    public override string ToString() => $"{f} {s}";
}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan => ReadLine().Split();
    public int[] scanint => Array.ConvertAll(scan, int.Parse);
    public long[] scanlong => Array.ConvertAll(scan, long.Parse);
    public double[] scandouble => Array.ConvertAll(scan, double.Parse);
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint => int.Parse(next);
    public long nextlong => long.Parse(next);
    public double nextdouble => double.Parse(next);
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using SB = System.Text.StringBuilder;
//using System.Threading.Tasks;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
using System.Numerics;
using static System.Math;
using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    readonly int dom = 998244353;
    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    bool calc(int day, int[] K, List<int>[] L, int Sum)
    {
        int money = 0;
        int done = 0;
        for (int i = 0; i < day; i++)
        {
            money++;
            foreach (var v in L[i])
            {
                int buy = Min(K[v], money);
                money -= buy;
                K[v] -= buy;
                done += buy;
            }
        }
        int remain = Sum - done;
        return remain * 2 <= money;
    }
    void solve()
    {
        int N = cin.nextint;
        int M = cin.nextint;
        var K = cin.scanint;

        var L = new List<int>[N];
        for (int i = 0; i < L.Length; i++)
        {
            L[i] = new List<int>();
        }
        for (int i = 0; i < M; i++)
        {
            L[cin.nextint - 1].Add(cin.nextint - 1);
        }
        int Sum = K.Sum();

        int money = 0;
        int done = 0;
        for (int i = 0; ; i++)
        {
            money++;
            if (i < L.Length)
            {
                foreach (var v in L[i])
                {
                    int buy = Min(K[v], money);
                    money -= buy;
                    K[v] -= buy;
                    done += buy;
                }
            }

            int remain = Sum - done;
            if (remain * 2 <= money)
            {
                WriteLine(i + 1);
                return;
            }
        }

        //int ng = 0;
        //int ok = Sum * 2;
        //while (ok - ng > 1)
        //{
        //    int mid = (ok + ng) / 2;

        //    var Z = new int[N];
        //    for (int i = 0; i < Z.Length; i++)
        //    {
        //        Z[i] = K[i];
        //    }

        //    if (calc(mid, Z, L, Sum))
        //    {
        //        ok = mid;
        //    }
        //    else
        //    {
        //        ng = mid;
        //    }
        //}

        //WriteLine(ok);

    }

}

static class Ex
{
    public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values));
    public static string concat<T>(this IEnumerable<T> values) => string.Concat(values);
    public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }

    public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) < 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
    public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) <= 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}

class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
{
    public T f; public U s;
    public Pair(T f, U s) { this.f = f; this.s = s; }
    public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);
    public override string ToString() => $"{f} {s}";
}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan => ReadLine().Split();
    public int[] scanint => Array.ConvertAll(scan, int.Parse);
    public long[] scanlong => Array.ConvertAll(scan, long.Parse);
    public double[] scandouble => Array.ConvertAll(scan, double.Parse);
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint => int.Parse(next);
    public long nextlong => long.Parse(next);
    public double nextdouble => double.Parse(next);
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace task39D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] point1 = Console.ReadLine().Split();
            Int32 x1 = Int32.Parse(point1[0]);
            Int32 y1 = Int32.Parse(point1[1]);
            Int32 z1 = Int32.Parse(point1[2]);
            string[] point2 = Console.ReadLine().Split();
            Int32 x2 = Int32.Parse(point2[0]);
            Int32 y2 = Int32.Parse(point2[1]);
            Int32 z2 = Int32.Parse(point2[2]);
            if (Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1)) - Math.Sqrt(2) <= 0.000001)
            {
                Console.WriteLine("YES");
            }
            else
                Console.WriteLine("NO");
            //Console.ReadLine();
        }
    }
}


using System;
using System.IO;
using System.Text;

namespace Cubical_Planet
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int x1 = Next(), y1 = Next(), z1 = Next();
            int x2 = Next(), y2 = Next(), z2 = Next();

            writer.WriteLine(x1 == x2 || y1 == y2 || z1 == z2 ? "YES" : "NO");
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Multiplication_Table
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();

            for (int i = 1; i < n; i++)
            {
                for (int j = 1; j < n; j++)
                {
                    writer.Write(ConvertToString(i*j, n));
                    writer.Write(' ');
                }
                writer.WriteLine();
            }

            writer.Flush();
        }

        private static string ConvertToString(int i, int b)
        {
            var st = new Stack<int>();
            while (i > 0)
            {
                st.Push(i%b);
                i /= b;
            }
            var bb = new StringBuilder();
            foreach (int j in st)
            {
                bb.Append((char) (j + '0'));
            }
            return bb.ToString();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;

namespace _39h
{
    class Program
    {

        static string ToPos(Int32 k, Int32 pos)
        {
            string result = "";
            while (k > 0)
            {
                result = (k % pos).ToString() + result;
                k = k / pos;
            }
            return result;
        }

        static void PrintMatr(Int32[,] arr, Int32 pos)
        {
            if (pos == 10)
            {
                for (int i = 0; i < 9; i++)
                {
                    for (int j = 0; j < 9; j++)
                    {
                        Console.Write(arr[i, j].ToString()+" ");
                    }
                    Console.WriteLine();
                }
            }
            else
            {
                for (int i = 0; i < pos-1; i++)
                {
                    for (int j = 0; j < pos-1; j++)
                    {
                        Console.Write(ToPos(arr[i, j], pos)+ " ");
                    }
                    Console.WriteLine();
                }
            }
        }
        static void Main(string[] args)
        {
            Int32 pos = 0;
            pos = Convert.ToInt32(Console.ReadLine());
            Int32[,] arr = new Int32[9, 9];
            for(int i = 1;i<10;i++)
                for (int j = 1; j < 10; j++)
                {
                    arr[i-1, j-1] = i * j;
                }
            PrintMatr(arr, pos);
            //Console.ReadLine();
            //
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;

namespace _39h
{
    class Program
    {

        static string ToPos(Int32 k, Int32 pos)
        {
            string result = "";
            while (k > 0)
            {
                result = (k % pos).ToString() + result;
                k = k / pos;
            }
            return result;
        }

        static void PrintMatr(Int32[,] arr, Int32 pos)
        {
            if (pos == 10)
            {
                for (int i = 0; i < 9; i++)
                {
                    for (int j = 0; j < 9; j++)
                    {
                        Console.Write("{1} ", arr[i, j]);
                    }
                    Console.WriteLine();
                }
            }
            else
            {
                for (int i = 0; i < pos-1; i++)
                {
                    for (int j = 0; j < pos-1; j++)
                    {
                        Console.Write(ToPos(arr[i, j], pos)+ " ");
                    }
                    Console.WriteLine();
                }
            }
        }
        static void Main(string[] args)
        {
            Int32 pos = 0;
            pos = Convert.ToInt32(Console.ReadLine());
            Int32[,] arr = new Int32[9, 9];
            for(int i = 1;i<10;i++)
                for (int j = 1; j < 10; j++)
                {
                    arr[i-1, j-1] = i * j;
                }
            PrintMatr(arr, 3);
            //Console.ReadLine();
            //
        }
    }
}


using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    int[] S;
    int N;
    PrimeFactor P;
    public Solve(){}
    StringBuilder sb;
    ReadData re;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        re = new ReadData();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        N = re.i();
        S = new int[N];
        P = new PrimeFactor(N);
        {
            string str = re.s();
            for(int i=0;i<N;i++){
                S[i] = str[i] - '0';
            }
        }
        if(Calc(N,1,0)){
            sb.Append("YES\n");
        }
        else{
            sb.Append("NO\n");
        }
    }
    bool Calc(int x,int y,int d){
         int p = P.LowestPrimeFactor[x];
         if(p == x){
             for(int i=d+y;i<N;i+=y){
                 if(S[d] != S[i]){
                     return false;
                 }
             }
             return true;
         }
         else if(x % (p*p) == 0){
             for(int i=0;i<p;i++){
                if(!Calc(x/p,y*p,d+i*y)){
                    return false;
                }
             }
             return true;
         }
         else{
             for(int i=d;i<N;i+=y*p){
                for(int j=1;j<p;j++){
                    S[(i+y*x/p*j)%N] -= S[i];
                }
             }
             for(int i=1;i<p;i++){
                if(!Calc(x/p,y*p,d+i*y)){
                    return false;
                }
             }
             return true;
         }
    }
}
class PrimeFactor{
    public int[] LowestPrimeFactor;
    public PrimeFactor(int N){
        N++;
        LowestPrimeFactor = new int[N];
        List<int> prime = new List<int>();
        for(int i=1;i<N;i++){
            LowestPrimeFactor[i] = i;
        }
        for(int i=2;i<N;i++){
            if(LowestPrimeFactor[i] == i){
                prime.Add(i);
            }
            for(int j=0;j<prime.Count;j++){
                if(prime[j]*i < N && prime[j] <= LowestPrimeFactor[i]){
                    LowestPrimeFactor[prime[j]*i] = prime[j];
                }
                else{
                    break;
                }
            }
        }
    }
    public int[] PrimeDivide(int X){
        List<int> ans = new List<int>();
        while(X != 1){
            ans.Add(LowestPrimeFactor[X]);
            X /= LowestPrimeFactor[X];
        }
        return ans.ToArray();
    }
    public int[] Divisor(int X){
        List<int> ans = new List<int>();
        ans.Add(1);
        while(X != 1){
            int p = LowestPrimeFactor[X];
            int c = 0;
            while(X % p == 0){
                X /= p;
                c++;
            }
            int l = ans.Count;
            int d = p;
            for(int i=1;i<=c;i++){
                for(int j=0;j<l;j++){
                    ans.Add(d*ans[j]);
                }
                d *= p;
            }
        }
        return ans.ToArray();
    }
}
class ReadData{
    string[] str;
    int counter;
    public ReadData(){
        counter = 0;
    }
    public string s(){
        if(counter == 0){
            str = Console.ReadLine().Split(' ');
            counter = str.Length;
        }
        counter--;
        return str[str.Length-counter-1];
    }
    public int i(){
        return int.Parse(s());
    }
    public long l(){
        return long.Parse(s());
    }
    public double d(){
        return double.Parse(s());
    }
    public int[] ia(int N){
        int[] ans = new int[N];
        for(int j=0;j<N;j++){
            ans[j] = i();
        }
        return ans;
    }
    public int[] ia(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        int[] ans = new int[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = int.Parse(str[j]);
        }
        return ans;
    }
    public long[] la(int N){
        long[] ans = new long[N];
        for(int j=0;j<N;j++){
            ans[j] = l();
        }
        return ans;
    }
    public long[] la(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        long[] ans = new long[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = long.Parse(str[j]);
        }
        return ans;
    }
    public double[] da(int N){
        double[] ans = new double[N];
        for(int j=0;j<N;j++){
            ans[j] = d();
        }
        return ans;
    }
    public double[] da(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        double[] ans = new double[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = double.Parse(str[j]);
        }
        return ans;
    }
    public List<int>[] g(int N,int[] f,int[] t){
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<f.Length;j++){
            ans[f[j]].Add(t[j]);
            ans[t[j]].Add(f[j]);
        }
        return ans;
    }
    public List<int>[] g(int N,int M){
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<M;j++){
            int f = i()-1;
            int t = i()-1;
            ans[f].Add(t);
            ans[t].Add(f);
        }
        return ans;
    }
    public List<int>[] g(){
        int N = i();
        int M = i();
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<M;j++){
            int f = i()-1;
            int t = i()-1;
            ans[f].Add(t);
            ans[t].Add(f);
        }
        return ans;
    }
}
public static class Define{
    public const long mod = 1000000007;
}
public static class Debug{
    public static void Print(double[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(double[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(double[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
    public static void Print(long[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(long[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(long[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
    public static void Print(int[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(int[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(int[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
}